package com.burry.services;

import java.util.Map;

import com.burry.db.SQLMachine;

public class GoodSubService {
	
	/**
	 * 增加版色的同时，维护该版色库存信息为0；
	 * @param colorId
	 * @param colorName
	 * @param goodId
	 * @param prdColor
	 * @param prdList
	 * @param prdCheck
	 * @param prdOrder
	 * @return
	 */
	public Map saveSubInfo(String colorId,String colorName,String goodId,String prdColor,String prdList,String prdCheck,String prdOrder){
		
		String sql = "insert into bu_good_sub values('"+goodId+"','"+colorId+"','"+colorName+"','"+prdColor+"','"+prdList+"','"+prdCheck+"','"+prdOrder+"')";
		SQLMachine sqlM = new SQLMachine("default");
		Map result = sqlM.updateResult(sql);
		
		String uSql = "insert into bu_color_size (select '"+goodId+"','"+colorId+"',content,0,0 from bu_size_info  where code = ( select good_size from bu_good_info where good_id = '"+goodId+"') )";
		result = sqlM.updateResult(uSql);
		return result;
	}
	
	public Map savePicInfo(String colorId,String colorName,String goodId,String prdColor,String prdList,String prdCheck,String prdOrder){
		String sql = "insert into bu_tcolor_pic(good_id,color_id,pic_name,prd_simple_pic,prd_normal_pic,prd_big_pic,prd_total_pic) values('"+goodId+"','"+colorId+"','"+colorName+"','"+prdColor+"','"+prdList+"','"+prdCheck+"','"+prdOrder+"')";
		SQLMachine sqlM = new SQLMachine("default");
		return sqlM.updateResult(sql);
	}
	
}
